const express = require('express');
const router = express.Router();
const server = require("../server/server.js");
const uploadserver = require("../server/uploadserver.js");
const newserver = require("../server/newserver.js");
const multer = require('multer');
//--------新的服务
router.get("/getnewlist",newserver.getnewslist);
router.get("/addclick/:id",uploadserver.addclicktime);
router.get("/getinfo/:id",newserver.getnewinfo);

router.get("/getimglisttype",newserver.GetImgInfoType);
router.get("/GetImgListByType/:type",newserver.GetImgListByType);
router.get("/GetImgInfoById/:id",newserver.GetImgInfoById);






//--------旧的服务
router.get("/swiptImage",server.getswiptimg);
router.get("/getinfo",server.getsqlinfo);
router.post("/setinfo",server.setsqlinfo);
router.post('/ImageUpload',multer().single('img'),server.imagesupload);
// router.post("/txtupload",server.txtupload);
router.post("/txtupload",uploadserver.uploadtxt);//测试端口(上传文档功能)
router.post("/setnewinfo",uploadserver.setnewsinfo)//输入信息再数据库的初始信息
router.post('/imgsupload',multer().array('imgs'),uploadserver.uploadimgs);//多图上传至后台
router.post('/uploadsqlimginfo',uploadserver.uploadsqlimginfo)//多图描述信息存储至数据库
router.post("/cmtupload",server.CmtUpload);
router.post("/showcmt",server.ShowCmt);
router.post("/imgdescupload",server.ImgDescUpload);
router.post("/setimginfosql",server.SetImgInfoSql);
router.get("/getimginfolist",server.GetImgInfo_List);
router.get("/getimginfotype",server.GetImgInfoType);
router.get("/getimginfolistbytype/:type",server.GetImgInfo_List_Type);
router.get("/getimginfolist/:id",server.GetImgInfoById);
module.exports = router;